队列数据结构

A ds_queue is a first-in-first-out data structure.

A ds_queue is somewhat similar to a ds_stack but it works on a first-in first-out (FIFO) basis. The value that is put into the queue first is also the first to be removed from it. You can think of it like a queue in a shop for paying, where the person that is first in the queue pays first and then leaves the shop. Queues are typically used to store actions or behaviours (in the form of scripts, for example) that still need to be done by an instance but there are many other uses.

注意:与所有动态资源一样,数据结构会占用你的内存,因此在不再使用时 应当进行销毁,以防止内存泄漏导致游戏发生crash

The following functions exist that deal with ds_queues:

  1. ds_queue_create
  2. ds_queue_destroy
  3. ds_queue_clear
  4. ds_queue_empty
  5. ds_queue_size
  6. ds_queue_dequeue
  7. ds_queue_enqueue
  8. ds_queue_head
  9. ds_queue_tail
  10. ds_queue_copy
  11. ds_queue_read
  12. ds_queue_write
注意:如果你需要检查数据结构是否存在,你可以使用ds_exists()函数。


上一页: Data Structures
下一页: DS Lists
© Copyright YoYo Games Ltd. 2018 All Rights Reserved